home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 49818 / 49818.xpi / content / classes.js next >
Text File  |  2010-02-09  |  45KB  |  5 lines

  1.  
  2. // Copyright 2009 Pierre Carbonnelle.  All rights reserved."
  3.  
  4. if(!be){var be={}};if(!be.yooper){be.yooper={}};be.yooper.APIServer="https://web-hi.appspot.com";be.yooper.pageServer="http://login.yooper.be";be.yooper.debug_assert=false;be.yooper.debug_gBrowser=false;be.yooper.debug_onPageLoaded=false;be.yooper.debug_onMouseUp=false;be.yooper.debug_onPageUnload=false;be.yooper.debug_doCommand=false;be.yooper.debug_doHCommand=false;be.yooper.debug_show=false;be.yooper.debug_stringToBoundary=false;be.yooper.debug_cache=false;be.yooper.debug_ajax=false;be.yooper.debug_label=false;be.yooper.debug_login=false;be.yooper.debug_title=false;be.yooper.debug_findwords=false;be.yooper.JSON=Components.classes["@mozilla.org/dom/json;1"].createInstance(Components.interfaces.nsIJSON);be.yooper.myDomain=new function(){this.domains=[];this.referrer=[];this.domainOf=function(a){try{if(a.hostname&&a.hostname!=""){return a.hostname}else{return a.protocol}}catch(e){return""}};this.setColor=function(a,b){;this.domains[a]=b};this.getColor=function(a){if(this.domains[a]){return this.domains[a]};return"yellow"};this.setCurrentDomain=function(a){domain=this.domainOf(a);be.yooper.currentUser.color=this.getColor(domain);document.getElementById('be.yooper.color').src="chrome://webhi/content/images/"+be.yooper.currentUser.color.replace("#","")+".png";if(!this.referrer[domain]){this.referrer[domain]=content.document.referrer}};this.DOUBLE=1;this.rules=[["(https?://mail\.google\.com/[^#]+)#(inbox|starred|sent|drafts)/(.+)","$1#inbox/$3",this.DOUBLE],["(https?://mail\.google\.com/[^#]+)#(label|search)/(.+)/(.+)","$1#inbox/$4",this.DOUBLE],["(https?://mail\.google\.com/.+)","$1",this.DOUBLE],["([^#]+#yooper_find)","$1",this.DOUBLE],["view=edit","",0],["action=edit","",0],["edit=1","",0],["edit=true","",0],["([^#]+)#(.+)","$1",0],];this.regExps=[];for(var i=0;i<this.rules.length;i++){this.regExps.push([new RegExp(this.rules[i][0].replace(/\//g,"\\/")),this.rules[i][1],this.rules[i][2]])};this.rewriteHref=function(a){for(var i=0;i<this.regExps.length;i++){var b=this.regExps[i];if(a.match(b[0])||0<=a.indexOf(b[0])){if(b[1]==""){a=""}else{a=a.replace(b[0],b[1])};return a}};return a};this.isDouble=function(a){for(var i=0;i<this.regExps.length;i++){if(a.match(this.regExps[i][0])){;return this.regExps[i][2]&this.DOUBLE}};return false};this.ancestorIsOK=function(a){try{if(a&&a.getAttribute("g_editable")=="true"){return false}}catch(e){};return true};this.ancestorsAreOK=function(a){while(a){if(!this.ancestorIsOK(a)){return false};a=a.parentNode};return true};this.addBase=function(a,b){if(!a){}else{var c=a.split("/");var d=c[0]+"//"+c[2];var e="";for(var i=3;i<c.length-1;i++){e+=c[i]+"/"};var f=new RegExp('([rs][er][fc])="([^"]+)"',"gi");var g=f.exec(b);while(g){var h=g[2];var j=h;if(/\/\//.test(h)){}else if(/\w+:/.test(h)){}else if(h.substr(0,1)=="/"){j=d+h}else{j=d+"/"+e+h}var k=(g[1]=="ref")?"href":"src";b=b.replace(k+'="'+h+'"',k+'="'+j+'"');g=f.exec(b)}};return b}};be.yooper.currentUser=new function(){this.key_name="unknown";this.color="yellow";var k=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);k=k.getBranch("extensions.yooper.");try{this.autoHighlight=k.getBoolPref("autohighlight")}catch(e){this.autoHighlight=true};this.mailtoDeadline=new Date();this.mailtoDeadline.setTime(this.mailtoDeadline.getTime()+20000);this.MAILBODY="*** Select this text "+"and paste from clipboard with Ctrl-V ***";this.onPageLoaded=function(a){doc=a.originalTarget;if(!doc instanceof HTMLDocument){return};be.yooper.myPage.init(doc)};this.onTabSelect=function(){;be.yooper.myPendingH.showRange();be.yooper.myPendingH.highlightSelection();topURL=be.yooper.myDomain.rewriteHref(content.document.location.href)};this.getCurrentTabIndex=function(){var a=Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);var b=a.getEnumerator("navigator:browser");var c=false;while(!c&&b.hasMoreElements()){var d=b.getNext().gBrowser;var e=gBrowser.getBrowserForTab(d.selectedTab);for(var f=0;f<d.browsers.length;f++){if(d.getBrowserAtIndex(f)===e){return(f)}}}};this.onStatusMenuShowing=function(){;be.yooper.myDo.refreshCurrent(content.document,be.yooper.myDomain.rewriteHref(content.document.location.href),0);be.yooper.myAjax.init(be.yooper.currentUser);var a=document.getElementById('menu_login');if(be.yooper.debug_assert&&!a){};var b=document.getElementById("strings");if(!be.yooper.myAjax.hasSession()){a.label=b.getString("login")}else{a.label=b.getString("logoff")};var a=document.getElementById('menu_auto');a.setAttribute("type","checkbox");if(this.autoHighlight){a.setAttribute("checked","true")}else{a.setAttribute("checked","false")};if(be.yooper.debug_login){}};this.auto=function(){this.autoHighlight=!this.autoHighlight;var a=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);a=a.getBranch("extensions.yooper.");a.setBoolPref("autohighlight",this.autoHighlight)};this.onColorMenuShowing=function(){};this.colorClicked=function(a){document.getElementById('be.yooper.colorpicker').hidePopup();domain=be.yooper.myDomain.domainOf(content.document.location);be.yooper.myDomain.setColor(domain,a);be.yooper.currentUser.color=a;document.getElementById('be.yooper.color').src="chrome://webhi/content/images/"+be.yooper.currentUser.color.replace("#","")+".png";be.yooper.myPendingH.savedColor=a;be.yooper.myPendingH.highlightSelection(true)};this.showSummary=function(){gBrowser.selectedTab=gBrowser.addTab(be.yooper.pageServer+'/summary?ID='+encodeURIComponent(be.yooper.myDomain.domainOf(content.document.location)))};this.undo=function(){if(!be.yooper.myPendingH.rangeDone){be.yooper.myPendingH.rangeDone=true;return};var a=be.yooper.myDomain.rewriteHref(content.document.location.href);var b=be.yooper.myPage.pop(a);if(!b){;return};be.yooper.myAjax.doCommand(['H-',b[2],b[0],b[1]])};this.removeHighlights=function(){var a=Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);var b=a.BUTTON_TITLE_IS_STRING*a.BUTTON_POS_0+a.BUTTON_TITLE_IS_STRING*a.BUTTON_POS_1+a.BUTTON_TITLE_IS_STRING*a.BUTTON_POS_2;var c={value:false};var d=document.getElementById("strings");var e=d.getString("confirmRemoveH");var f=a.confirmEx(window,"Remove highlights",e,b,"Remove highlights","Cancel",null,null,c);if(f!=0){return};elements=content.document.getElementsByClassName('yooper_span');var g=be.yooper.myDomain.rewriteHref(content.document.location.href);be.yooper.myAjax.doCommand(['H0',g,g]);var h=be.yooper.myDo.getDocsForDoc(content.document);for(var i=0;i<h.length;i++){elements=h[i].getElementsByClassName('yooper_span');var j=be.yooper.myDomain.rewriteHref(h[i].location.href);if(0<elements.length){be.yooper.myAjax.doCommand(['H0',g,j])}};be.yooper.myPage.pages[g]=[]};this.hideHighlights=function(){var a=be.yooper.myDo.getDocsForDoc(content.document);for(var i=0;i<a.length;i++){;be.yooper.myDo.changeHighlights(a[i],true,false)}};this.CHARS='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');this.randomID=function(){var a=[];for(var i=0;i<9;i++){a[i]=this.CHARS[0|Math.random()*62]};return be.yooper.currentUser.key_name+"-"+a.join('')};this.clipboardText=function(){return this.clipboard("text/unicode")};this.clipboardHTML=function(){return this.clipboard("text/html")};this.clipboard=function(a){var b=Components.classes["@mozilla.org/widget/clipboard;1"].getService(Components.interfaces.nsIClipboard);if(!b){return false};var c=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);if(!c){return false};c.addDataFlavor(a);b.getData(c,b.kGlobalClipboard);var d=new Object();var f=new Object();try{c.getTransferData(a,d,f)}catch(e){d=""};if(d){d=d.value.QueryInterface(Components.interfaces.nsISupportsString)};if(d){pastetext=d.data.substring(0,f.value/2)}else{pastetext=""};return pastetext};this.wrapHTML=function(a,b){var c='<br><table><tr><td style="color: grey; border: 1px solid blue; padding: 5px">\n';c+=a;if(b.length==1){c+='</td></tr><tr><td style="color: grey;font-size: small;"><i>collected from <a href=';c+=b[0];c+='>this page</a> with <a href="http://www.yooper.be">Yooper</a>.</i></td></tr></table>\n'}else{c+='</td></tr><tr><td style="color: grey;font-size: small;"><i>collected with <a href="http://www.yooper.be">Yooper</a>.</i></td></tr></table><br>\n'};return c};this.copy=function(){be.yooper.myPendingH.highlightSelection();topURL=be.yooper.myDomain.rewriteHref(content.document.location.href);Hs=be.yooper.cache.highlightsOf(topURL);var a="",HTML="";for(var i=0;i<Hs.length;i++){a+=Hs[i][1]+"\n";HTML+=be.yooper.myDomain.addBase(Hs[i][6],Hs[i][13])+"<br>\n"};HTML=this.wrapHTML(HTML,[content.document.location.href]);this.copy2(a,HTML)};this.copy2=function(a,b){var c=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);c.data=a;var d=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);d.data=b;var e=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);e.addDataFlavor("text/unicode");e.setTransferData("text/unicode",c,a.length*2);e.addDataFlavor("text/html");e.setTransferData("text/html",d,b.length*2);var f=Components.classes["@mozilla.org/widget/clipboard;1"].getService(Components.interfaces.nsIClipboard);f.setData(e,null,Components.interfaces.nsIClipboard.kGlobalClipboard)};this.copyAndMail=function(){this.copy();this.mail()};this.mail=function(){var a=new Date();be.yooper.currentUser.mailtoDeadline.setTime(a.getTime()+20000);title=document.title.replace(" - Mozilla Firefox","");var b=gBrowser.addTab('mailto:?subject='+encodeURIComponent(title)+'&body='+encodeURIComponent(be.yooper.currentUser.MAILBODY));gBrowser.selectedTab=b}};be.yooper.myPage=new function(){this.pages=[];this.push=function(a,b){if(!be.yooper.myPage.pages[a]){be.yooper.myPage.pages[a]=[]};be.yooper.myPage.pages[a].push(b)};this.pop=function(a){;if(!be.yooper.myPage.pages[a]){return null};return be.yooper.myPage.pages[a].pop()};this.removeFromUndo=function(a,b){if(!be.yooper.myPage.pages[a]){return};be.yooper.myPage.pages[a]=be.yooper.myPage.pages[a].filter(function(e){if(e[2]!=b){return true}else{;return false}})};this.init=function(f){;f.addEventListener("mousedown",be.yooper.myPage.onMouseDown,false);f.addEventListener("mouseup",be.yooper.myPage.onMouseUp,false);f.addEventListener("dblclick",be.yooper.myPage.onDoubleClick,false);var g=document.getElementById("contentAreaContextMenu");if(g){g.addEventListener("popupshowing",be.yooper.myPage.showContextMenu,false)};var h=be.yooper.myDomain.rewriteHref(f.defaultView.top.document.location.href);var j=be.yooper.myDomain.rewriteHref(f.location.href);if(content.document.location.href==f.location.href){be.yooper.myDo.reset()};if(h!=""&&j!=""){be.yooper.myAjax.doCommand(['H?',h,j]);if(be.yooper.debug_onPageLoaded){}};var k=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);k=k.getBranch("extensions.yooper.");if(!be.yooper.myAjax.hasSession()){var l=-1,firstrun=true;try{firstrun=k.getBoolPref("firstrun")}catch(e){}finally{if(firstrun){k.setBoolPref("firstrun",false);window.setTimeout(function(){gBrowser.selectedTab=gBrowser.addTab("http://login.yooper.be/congratulations")},1500)}}}else{k.setBoolPref("firstrun",false)};if(be.yooper.myDomain.domainOf(f.location)=="web-hi.appspot.com"||be.yooper.myDomain.domainOf(f.location)=="localhost"){try{var m=f.getElementById("commandsToDo");if(m){m=m.value;var m=be.yooper.JSON.decode(m);for(var i=0;i<m.length;i++){var n=m[i][1];var h=m[i][2];if(m[i][0]=="H-"){be.yooper.cache.removeH(n);be.yooper.myDo.refreshAll(m[i],0,be.yooper.myAjax.freshness);be.yooper.myPage.removeFromUndo(h,n)}else if(m[i][0]=="H0"){be.yooper.cache.removeP(n,h);be.yooper.myDo.refreshAll(m[i],0,be.yooper.myAjax.freshness);be.yooper.myPage.pages[h]=[]}}}else{}}catch(e){};var o=f.getElementById("yooperMenu");if(o){o.setAttribute("style","display: inline;")};var p=f.getElementById("zeroclipboard");if(p){p.setAttribute("style","display: none;")};mnuCopy=f.getElementById("mnuCopyX");if(mnuCopy){;mnuCopy.addEventListener("click",function(){;var a=f.getElementById("clipText").value;var b=f.getElementById("clipHTML").value;var c=f.getElementById("clipURLs").value;c=be.yooper.JSON.decode(c);b=be.yooper.currentUser.wrapHTML(b,c);be.yooper.currentUser.copy2(a,b)},false)};mnuCut=f.getElementById("mnuCutX");if(mnuCut){;mnuCut.addEventListener("click",function(){;var a=f.getElementById("clipText").value;var b=f.getElementById("clipHTML").value;var c=f.getElementById("clipURLs").value;c=be.yooper.JSON.decode(c);b=be.yooper.currentUser.wrapHTML(b,c);be.yooper.currentUser.copy2(a,b)},false)};btnMail=f.getElementById("mnuMail");if(btnMail){;btnMail.addEventListener("click",function(){;var a=f.getElementById("clipText").value;var b=f.getElementById("clipHTML").value;var c=f.getElementById("clipURLs").value;c=be.yooper.JSON.decode(c);b=be.yooper.currentUser.wrapHTML(b,c);be.yooper.currentUser.copy2(a,b);be.yooper.currentUser.mail()},false)};window.addEventListener('keypress',function(a){if(a.charCode==99&&a.ctrlKey){;var b=f.getElementById("clipText").value;var c=f.getElementById("clipHTML").value;var d=f.getElementById("clipURLs").value;d=be.yooper.JSON.decode(d);c=be.yooper.currentUser.wrapHTML(c,d);be.yooper.currentUser.copy2(b,c)}},false)};var q=new Date();if(q<be.yooper.currentUser.mailtoDeadline&&f instanceof HTMLDocument){setTimeout(function(){be.yooper.myPage.pasteInMail(f,0)},500)}};this.pasteInMail=function(a,b){var c=new Date();if(c<be.yooper.currentUser.mailtoDeadline){var d=false;var f=a.body.textContent.length;if(b!=f){try{;var g=a.body;while(!d&&g){if(g.nodeType==3&&0<=g.textContent.indexOf(be.yooper.currentUser.MAILBODY)){;g.parentNode.innerHTML=g.parentNode.innerHTML.replace(be.yooper.currentUser.MAILBODY,be.yooper.currentUser.clipboardHTML());d=true;break};g=be.yooper.DOM.nextNode2(g)}}catch(e){}};if(!d){setTimeout(function(){be.yooper.myPage.pasteInMail(a,f)},500)}}else{a=null}};this.mouseDownCoord={x:0,y:0};this.onMouseDown=function(a){be.yooper.myPage.mouseDownCoord={x:a.pageX,y:a.pageY}};this.onDoubleClick=function(a){;be.yooper.myPendingH.rangeDone=false};this.onMouseUp=function(a){var b=a.target.ownerDocument;if(a.button==2){return};be.yooper.myPendingH.showRange();be.yooper.myPendingH.highlightSelection();be.yooper.myPendingH.showRange();if(be.yooper.debug_onMouseUp){};var c=b.defaultView;if(!c){;return};var d=c.getSelection();if(!d){;return};var e;if(d.rangeCount!=0){e=d.getRangeAt(0)};if(Math.abs(be.yooper.myPage.mouseDownCoord.x-a.pageX)<2&&Math.abs(be.yooper.myPage.mouseDownCoord.y-a.pageY)<2){;be.yooper.myPendingH.rangeDone=true}else if(be.yooper.myPendingH.savedRange==null){be.yooper.myPendingH.rangeDone=false}else if(e&&e.toString()!=""&&e.toString()!=be.yooper.myPendingH.savedRange.toString()){be.yooper.myPendingH.rangeDone=false}else{;be.yooper.myPendingH.rangeDone=true};if(b&&e){;be.yooper.myPendingH.topDoc=content.document;be.yooper.myPendingH.rangeDoc=b;be.yooper.myPendingH.savedRange=e;be.yooper.myPendingH.savedColor=be.yooper.currentUser.color;be.yooper.myPendingH.clipboardAfterSelection=be.yooper.currentUser.clipboardText()}else{};be.yooper.myPendingH.showRange()};this.showContextMenu=function(a){var b=document.getElementById("context.highlight");b.disabled=be.yooper.myPendingH.rangeDone||be.yooper.myPendingH.topDoc!=content.document;var c=document.popupNode;var d=be.yooper.DOM.highlightID(c);var e=document.getElementById("context.deHighlight");e.disabled=(d==null);e.value=d};this.contextHighlight=function(){var a=be.yooper.myDomain.domainOf(content.document.location);var b=be.yooper.myDomain.getColor(a);b=(b!="noMarker")?b:"yellow";be.yooper.myPendingH.savedColor=b;be.yooper.myPendingH.highlightSelection(true)};this.contextDehighlight=function(){var a=document.popupNode;var b=be.yooper.DOM.highlightID(a);var c=be.yooper.myDomain.rewriteHref(content.document.location.href);var d=be.yooper.myDomain.rewriteHref(a.ownerDocument.location.href);be.yooper.myAjax.doCommand(['H-',b,c,d]);be.yooper.myPage.removeFromUndo(c,b)}};be.yooper.myPendingH=new function(){this.topDoc=null;this.rangeDoc=null;this.savedRange=null;this.savedColor=null;this.rangeDone=true;this.clipboardAfterSelection="";this.showRange=function(){if(be.yooper.myPendingH.savedRange){}else{}};this.highlightSelection=function(a){if(be.yooper.myPendingH.rangeDone){return};if(!a&&!be.yooper.currentUser.autoHighlight){return};be.yooper.myPendingH.rangeDone=true;myDoc=be.yooper.myPendingH.rangeDoc;range=be.yooper.myPendingH.savedRange;if(!myDoc||!myDoc.location){;return};if(!range){;return};frURL=be.yooper.myDomain.rewriteHref(myDoc.location.href);topURL=be.yooper.myDomain.rewriteHref(be.yooper.myPendingH.topDoc.location.href);if(topURL==""||frURL==""){;return};if(!range||range.collapsed){;be.yooper.myDo.refreshCurrent(be.yooper.myPendingH.topDoc,topURL,0);return};if(!a&&be.yooper.currentUser.color=="noMarker"){;return};selection=range.toString();if(20000<selection.length){;return};if(be.yooper.myPendingH.clipboardAfterSelection.replace(/\s/g,"")!=be.yooper.currentUser.clipboardText().replace(/\s/g,"")&&!a){;return};var b,end;if(be.yooper.debug_stringToBoundary){};if(range.startContainer.ownerDocument!==myDoc){};if(!be.yooper.myDomain.ancestorsAreOK(range.startContainer)){;return};if(!be.yooper.myDomain.ancestorsAreOK(range.endContainer)){;return};if(range.startContainer.nodeType==3){startNode=range.startContainer;startOffset=range.startOffset}else{;startNode=range.startContainer.childNodes[range.startOffset];startOffset=0;while(startNode.nodeType!=3){startNode=be.yooper.DOM.nextNode(startNode)}};if(range.endContainer.nodeType==3){endNode=range.endContainer;endOffset=range.endOffset}else{;endNode=range.endContainer.childNodes[range.endOffset];while(endNode.nodeType!=3){endNode=be.yooper.DOM.previousNode(endNode)};endOffset=endNode.textContent.length};b=be.yooper.myPendingH.boundaryToString(myDoc,startNode,startOffset);if(be.yooper.debug_assert){var c=be.yooper.myPendingH.stringToBoundary(myDoc,b[0],b[1]);if(!c){if(be.yooper.debug_onMouseUp){};return};if(c.container!=startNode){}};if(be.yooper.debug_stringToBoundary){};end=be.yooper.myPendingH.boundaryToString(myDoc,endNode,endOffset);color=be.yooper.myPendingH.savedColor;referrer=be.yooper.myDomain.referrer[be.yooper.myDomain.domainOf(be.yooper.myPendingH.topDoc.location)];try{title=be.yooper.myPendingH.topDoc.title;if(!title){title="?"}}catch(e){title="?"};signature=be.yooper.myPendingH.signature(range.toString());selectionHTML=be.yooper.myPendingH.toHTML(range.cloneContents());if(selectionHTML.match(/<\s*t[dr]/i)&&!selectionHTML.match(/<\s*table/i)){selectionHTML="<table>"+selectionHTML+"</table>"};if(range.toString().replace(/^\s+|\s+$/g,"")==""&&!selectionHTML.match(/<\s*img/i)){return};if(be.yooper.debug_assert){if(frURL.length==0){};if(b[0].length==0){};if(b[1].length==0){};if(end[0].length==0){};if(end[1].length==0){};if(signature.length==0){};if(color.length==0){};if(title.length==0){};if(selection.length==0){}};var d=be.yooper.currentUser.randomID();be.yooper.myAjax.doCommand(['H+',selection,color,referrer,title,topURL,frURL,b[0],b[1],end[0],end[1],d,signature,selectionHTML])};this.toHTML=function(a){;var b="";for(var i=0;i<a.childNodes.length;i++){b+=be.yooper.myPendingH.getOuterHTML(a.childNodes.item(i))};return b};this.getInnerHTML=function(a){var b="";for(var i=0;i<a.childNodes.length;i++){b+=be.yooper.myPendingH.getOuterHTML(a.childNodes.item(i))};return b};this.leafElems=[];this.leafElems["IMG"]=1;this.leafElems["HR"]=1;this.leafElems["BR"]=1;this.leafElems["INPUT"]=1;this.getOuterHTML=function(a){var b="";switch(a.nodeType){case 1:if(a.className!="yooper_span"){b+="<"+a.nodeName;for(var i=0;i<a.attributes.length;i++){if(a.attributes.item(i).nodeValue!=null&&a.attributes.item(i).nodeName.substr(0,2)!="on"){b+=" ";b+=a.attributes.item(i).nodeName;b+="=\"";b+=a.attributes.item(i).nodeValue;b+="\""}};if(a.childNodes.length==0&&this.leafElems[a.nodeName]){b+=">"}else{b+=">";b+=this.getInnerHTML(a);b+="</"+a.nodeName+">"}}else{b+=this.getInnerHTML(a)};break;case 3:b+=a.nodeValue;break;case 4:break;case 5:b+="&"+a.nodeName+";";break;case 8:break};return b};this.boundaryToString=function(a,b,c){if(b.ownerDocument!==a){};if(b.nodeType!=3){;return["?","?"]};xpath=be.yooper.myPendingH.getXPath(a,b,"");if(be.yooper.debug_stringToBoundary){};ancestor=be.yooper.myPendingH.stringToBoundary(a,xpath,0);ancestor=ancestor.container;var d=content.document.createRange();d.setStart(ancestor,0);c=(c<=b.length)?c:b.length;d.setEnd(b,c);c=d.toString();c=c.length;return[xpath,c]};this.getXPath=function(a,b,c){var d;c=c||"";if(b.parentNode){c=be.yooper.myPendingH.getXPath(a,b.parentNode,c)}else{if(b!==a){}};var e=null;if(be.yooper.DOM.previousSibling(b)){e=1;d=be.yooper.DOM.previousSibling(b);do{if(d.nodeType==1&&d.nodeName==b.nodeName){e++};d=be.yooper.DOM.previousSibling(d)}while(d);if(e==1){e=null}};var f=e;if(e==null&&be.yooper.DOM.nextSibling(b)){d=be.yooper.DOM.nextSibling(b);do{if(d.nodeType==1&&d.nodeName==b.nodeName){e++;break};d=be.yooper.DOM.nextSibling(d)}while(d)};if(b.nodeType==1&&b.className!="yooper_span"&&b.id.substr(0,11)!='bits_marker'){c=c+"/"+(b.nodeName.toLowerCase()+(e>0?"["+e+"]":''))};return c};this.stringToBoundary=function(a,b,c){if(be.yooper.debug_assert&&!a){};if(be.yooper.debug_stringToBoundary){};var d=a.firstChild;var i;if(b!="/"){var e=b.split("/");if(be.yooper.debug_assert&&e[0]!==""){};if(be.yooper.debug_stringToBoundary){};var f=e[1].split('[');var g=f[0].toLowerCase();var h=(f[1])?f[1].substr(0,f[1].length-1):1;if(g=="frames"){;d=a.defaultView.frames[1*h].document}else{if(!d){if(be.yooper.debug_stringToBoundary){};return null};var j=0;while(d){if(d.nodeType==1&&d.nodeName.toLowerCase()==g){j++;if(j==h){break}};d=d.nextSibling};if(j!=h){if(be.yooper.debug_stringToBoundary){};return null}};e.shift();e.shift();var k="/"+e.join('/');if(be.yooper.debug_stringToBoundary){};return be.yooper.myPendingH.stringToBoundary(d,k,c)}else if(d){while(d){var l=be.yooper.myPendingH.stringToBoundary(d,b,c);if(l&&l.found){break};c=l.offset;d=d.nextSibling};return l}else{var m=new Object;if(a.nodeType!=3){m.found=false;m.container=a;m.offset=c;return m}else if(c<=a.length){m.found=true;m.container=a;m.offset=c;return m}else{m.found=false;m.container=a;m.offset=c-a.length;if(be.yooper.debug_assert&&m.offset<0){};return m}}};this.signature=function(a){var r="1";var b=Math.sqrt(a.length-1);for(var i=0;i<=b;i++){r+=a.substr(i*i,1)};r+=a.substr(a.length-1,1);return r}};be.yooper.DOM=new function(){this.isIn=function(a,b){node=a;while(node){if(node==b){return true};node=node.parentNode};return false};this.highlightID=function(a){node=a;while(node){if(node.className=="yooper_span"){return node.id};node=node.parentNode};return null};this.nextNode=function(a){if(!a){};if(this.firstChild(a)){a=this.firstChild(a);if(!a){}}else if(this.nextSibling(a)){a=this.nextSibling(a);if(!a){}}else{var b=false;while(!b){a=a.parentNode;if(!a){;return null};if(this.nextSibling(a)){a=this.nextSibling(a);b=true}}};return a};this.previousNode=function(a){if(!a){};if(this.lastChild(a)){a=this.lastChild(a);if(!a){}}else if(this.previousSibling(a)){a=this.previousSibling(a);if(!a){}}else{var b=false;while(!b){a=a.parentNode;if(!a){;return null}if(this.previousSibling(a)){a=this.previousSibling(a);b=true}}};return a};this.nextNode2=function(a){if(!a){};if(a.firstChild){a=a.firstChild;if(!a){}}else if(a.nextSibling){a=a.nextSibling;if(!a){}}else{var b=false;while(!b){a=a.parentNode;if(!a){;return null}if(a.nextSibling){a=a.nextSibling;b=true}}};return a};this.ignore=function(a){return(a.nodeType==8)||((a.nodeType==3)&&!(/[^\t\n\r ]/.test(a.data)))};this.previousSibling=function(a){while((a=a.previousSibling)){if(!this.ignore(a)){return a}};return null};this.nextSibling=function(a){while((a=a.nextSibling)){if(!this.ignore(a)){return a}};return null};this.lastChild=function(a){var b=a.lastChild;while(b){if(!this.ignore(b)){return b};b=b.previousSibling};return null};this.firstChild=function(a){var b=a.firstChild;while(b){if(!this.ignore(b)){return b};b=b.nextSibling};return null}};be.yooper.myAjax=new function(){this.lastTimestamp="?";this.lastPSent=0;this.freshness=0;this.FROM_USER=1;this.FROM_CACHE=2;this.FROM_SERVER=3;this.init=function(a){if(navigator.onLine&&be.yooper.myAjax.hasSession()){;var b=new Date();b=b.getTime();if(be.yooper.myAjax.lastTimestamp=="?"&&(be.yooper.myAjax.lastPSent==0||be.yooper.myAjax.lastPSent+20000<b)){be.yooper.myAjax.lastPSent=b;var c=be.yooper.cache.dump();c.push(['?','P?']);be.yooper.myAjax.send(c)}}else{};if(be.yooper.debug_login){};try{if(!be.yooper.myAjax.hasSession()||!navigator.onLine){document.getElementById('be.yooper.status').src="chrome://webhi/content/images/redLight.png"}else{document.getElementById('be.yooper.status').src="chrome://webhi/content/images/greenLight.png"}}catch(e){}};this.hasSession=function(){try{var a=Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);var b=a.newURI("http://web-hi.appspot.com/",null,null);var c=Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService);var d=c.getCookieString(b,null);return(0<=d.indexOf('web-hi-token')&&-1==d.indexOf("web-hi-token='None'"))}catch(err){return be.yooper.APIServer=="http://localhost"}};this.logIn=function(){;if(!be.yooper.myAjax.hasSession()){if(be.yooper.debug_login){};gBrowser.selectedTab=gBrowser.addTab(be.yooper.pageServer+'/login')}else{;var a=Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);var b=a.newURI("http://web-hi.appspot.com/",null,null);var c=Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService);c.setCookieString(b,null,"web-hi-token='None';",null);be.yooper.cache.cache=[];be.yooper.myAjax.lastTimeStamp="?";document.getElementById('be.yooper.status').src="chrome://webhi/content/images/redLight.png"}};this.doCommand=function(b){if(be.yooper.debug_doCommand){};if(be.yooper.debug_cache){this.showCache()};if(be.yooper.myAjax.lastTimeStamp=="?"){be.yooper.myAjax.init()};var c=b[0];arguments=b;timestamp=be.yooper.myAjax.lastTimestamp;firstLine=[timestamp,be.yooper.currentUser.key_name];var d=[];if(c=="H+"||c=="H0"||c=="H-"){be.yooper.myAjax.onAnswer(be.yooper.JSON.encode([firstLine,b]),be.yooper.myAjax.FROM_USER);d=[timestamp].concat(b)}else if(c=="H?"){page=be.yooper.cache.findH(arguments[1],arguments[2]);timestamp=(page)?page.timestamp:be.yooper.myAjax.lastTimestamp;firstLine=[timestamp,be.yooper.currentUser.key_name];if(page){if(be.yooper.cache.hasH(arguments[1],arguments[2])){var a=[];for(var h in page.Hs){a.push(page.Hs[h])};if(a){be.yooper.myAjax.onAnswer(be.yooper.JSON.encode([firstLine].concat(a)),be.yooper.myAjax.FROM_CACHE)}}else if(be.yooper.myAjax.hasSession()&&navigator.onLine){;page.Hs=[];d=[timestamp].concat(b)}else{}}else{if(be.yooper.debug_ajax){}}}else{if(be.yooper.debug_assert){}};if(d.length!=0&&be.yooper.myAjax.hasSession()&&navigator.onLine){be.yooper.myAjax.send([d])}};this.send=function(a){string=be.yooper.JSON.encode(a);if(be.yooper.debug_ajax){};var b=new XMLHttpRequest();b.overrideMimeType('text/plain; charset=x-user-defined');b.onreadystatechange=function(){try{if(b.readyState==4){if(b.status==200){if(be.yooper.debug_ajax){};be.yooper.myAjax.onAnswer(b.responseText,be.yooper.myAjax.FROM_SERVER)}}}catch(e){}};URL=be.yooper.APIServer+'/a';if(0<string.indexOf("P?")){URL+="init"}else if(0<string.indexOf("H?")){URL+="onload"}else if(0<string.indexOf("H+")){URL+="highlight"};if(be.yooper.debug_ajax){};b.open('POST',URL,true);b.setRequestHeader('Content-Type','application/json');b.channel.loadFlags|=Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE;b.setRequestHeader("Cache-Control","no-cache");b.send((string));if(be.yooper.debug_ajax){}};this.onAnswer=function(a,b){commands=be.yooper.JSON.decode(a);var c=null;var d=null;var e=null;var f=null;var g=false;var h=false;for(var i=0;i<commands.length;i++){;arguments=commands[i];if(arguments[0]=='/*'){break}else if(2<arguments[0].length){be.yooper.myAjax.lastTimestamp=arguments[0];if(be.yooper.currentUser.key_name=="unknown"){;be.yooper.currentUser.key_name=arguments[1]}else if(be.yooper.currentUser.key_name!=arguments[1]){};if(4<=arguments.length){c=arguments[2];d=arguments[3];f=be.yooper.cache.findH(c,d);if(f){f.timestamp=arguments[0]}}}else if(arguments[0]=='H+'){k=arguments[5];frURL=arguments[6];var j=arguments[11];be.yooper.myPage.push(k,[k,frURL,j]);f=be.yooper.cache.findH(k,frURL);if(b==be.yooper.myAjax.FROM_USER||b==be.yooper.myAjax.FROM_SERVER){be.yooper.myAjax.freshness++;if(f!=null){f.timestamp=be.yooper.myAjax.lastTimestamp;f.freshness=be.yooper.myAjax.freshness;if(!f.Hs instanceof Array){f.Hs=[]}}else{f={URL:k+"---"+frURL,timestamp:be.yooper.myAjax.lastTimestamp,freshness:be.yooper.myAjax.freshness,Hs:[]};be.yooper.cache.cache[f.URL]=f};f.Hs[j]=commands[i]}else{if(!f){}};if(b==be.yooper.myAjax.FROM_USER||b==be.yooper.myAjax.FROM_SERVER){be.yooper.myDo.refreshAll(commands[i],0,be.yooper.myAjax.freshness)}else{h=true}}else if(arguments[0]=='H0'){be.yooper.cache.removeP(arguments[1],arguments[2]);if(b==be.yooper.myAjax.FROM_USER){be.yooper.myDo.refreshAll(commands[i],0,be.yooper.myAjax.freshness)}else{h=true}}else if(arguments[0]=='H-'){;be.yooper.cache.removeH(arguments[1]);if(b==be.yooper.myAjax.FROM_USER||b==be.yooper.myAjax.FROM_SERVER){be.yooper.myDo.refreshAll(commands[i],0,be.yooper.myAjax.freshness)}else{h=true}}else if(arguments[0]=='P+'){f=be.yooper.cache.findH(arguments[1],arguments[2]);if(!f){e={URL:arguments[1]+"---"+arguments[2],timestamp:null,freshness:be.yooper.myAjax.freshness,Hs:[]};be.yooper.cache.cache[e.URL]=e;if(content.document.location.href==arguments[1]){be.yooper.myAjax.doCommand(['H?',arguments[1],arguments[2]])}};h=true;be.yooper.myDo.reset()}else{}};if(be.yooper.debug_cache){this.showCache()};if(h&&b!=be.yooper.myAjax.FROM_USER){;var k=be.yooper.myDomain.rewriteHref(content.document.location.href);be.yooper.myDo.refreshCurrent(content.document,k,0)}}};be.yooper.cache=new function(){this.cache=[];this.showCache=function(){var a="*** Cache :\n";for(var i in be.yooper.cache.cache){a+=be.yooper.cache.cache[i].URL+" ("+be.yooper.cache.cache[i].timestamp+") : \n";for(var h in be.yooper.cache.cache[i].Hs){a+="  "+be.yooper.JSON.encode(be.yooper.cache.cache[i].Hs[h])+"\n"};a+="-----end highlight\n"}};this.dump=function(){var a=[];for(var i in be.yooper.cache.cache){for(var h in be.yooper.cache.cache[i].Hs){a.push(["?"].concat(be.yooper.cache.cache[i].Hs[h]))}};return a};this.findH=function(a,b){var c=be.yooper.cache.findHi(a,b);return((c)?be.yooper.cache.cache[c]:null)};this.findHi=function(a,b){var c=a+"---"+b;try{var d=be.yooper.cache.cache[c];return((d)?c:null)}catch(e){return null}};this.hasH=function(a,b){var c=be.yooper.cache.findH(a,b);if(!c){return false};for(var h in c.Hs){return true};return false};this.highlightsOf=function(a){var b=[];for(var i in be.yooper.cache.cache){if(a+"---"==be.yooper.cache.cache[i].URL.substr(0,a.length+3)){Hs=be.yooper.cache.cache[i].Hs;for(var j in Hs){b.push(Hs[j])}}};return b};this.removeH=function(a){be.yooper.myAjax.freshness++;for(var b in be.yooper.cache.cache){var c=be.yooper.cache.cache[b];if(c.Hs[a]){;var d=[];for(var j in c.Hs){if(j!=a){d[j]=c.Hs[j]}};be.yooper.cache.cache[b].Hs=d;break}}};this.removeP=function(a,b){be.yooper.myAjax.freshness++;var c=be.yooper.cache.findHi(a,b);if(c){be.yooper.cache.cache[c]={URL:c,timestamp:be.yooper.myAjax.lastTimestamp,freshness:be.yooper.myAjax.freshness,Hs:[]}}}};be.yooper.myDo=new function(){this.aDocument="";this.topURL="";this.attempt=0;this.text=[];this.tabIndex=0;this.lastNode;this.lastPos;this.reset=function(){;this.aDocument="";this.topURL="";this.attempt=0;this.text=[]};this.refreshCurrent=function(a,b,c){;if(!a){;return};be.yooper.myDo.aDocument=a;if(be.yooper.myDo.topURL!=b||5<be.yooper.myDo.attempt){be.yooper.myDo.topURL=b;be.yooper.myDo.attempt=c;if(c<0||0<=b.indexOf("http://mail.google.com")){be.yooper.myDo.attempt++;c++;setTimeout("be.yooper.myDo.refreshCurrent2('"+b+"')",1500)}else{be.yooper.myDo.refreshCurrent2(b)}}else{be.yooper.myDo.refreshCurrent2(b)}};this.refreshCurrent2=function(a){;if(a==""){;return};if(be.yooper.myDo.topURL!=""&&a!=be.yooper.myDo.topURL){;return};aDocument=be.yooper.myDo.aDocument;if(!aDocument){;return};a=be.yooper.myDo.topURL;attempt=be.yooper.myDo.attempt;if(a!=be.yooper.myDomain.rewriteHref(aDocument.location.href)){;return};var b=be.yooper.myDo.getDocsForDoc(aDocument);var c=false;var d=[];for(var e=0;e<b.length;e++){var f=b[e];var g=be.yooper.myDomain.rewriteHref(f.location.href);var h=be.yooper.cache.findH(a,g);if(h){var k=h.Hs;for(var l in k){if(!d[l]){d[l]=false}}var m="";if(f.body){m=this.getTextContent(f).toLowerCase()}else if(f.documentElement&&f.documentElement.body){m=this.getTextContent(f.documentElement).toLowerCase()}else{};if(m.length<5){}else if(be.yooper.myDo.text[e]&&be.yooper.myDo.text[e]==m){}else{be.yooper.myDo.text[e]=m;var n=h.freshness;var o=f.getElementsByClassName('yooper_span');for(var i=o.length-1;0<=i;i--){var p=o[i];var H=k[p.id];if(!H){var q=p.childNodes;if(q.length<=0){}else{for(var j=0;j<q.length;j++){p.parentNode.insertBefore(q[j],p)}};p.parentNode.removeChild(p)}};var r=false;var s=true;for(var l in k){s=false;r=be.yooper.myDo.doHCommand(f,k[l],be.yooper.myAjax.FROM_CACHE,n,m);if(!r){d[l]=true}};if(s){d[0]=false}}}};var t=false;for(var l in d){;if(!d[l]){t=true;break}};if(t&&attempt<10){be.yooper.myDo.attempt++;attempt++;setTimeout("be.yooper.myDo.refreshCurrent2('"+a+"')",2000)}else{be.yooper.myDo.attempt=10}};this.getDocsForDoc=function(a){var b=[a];var c=a.defaultView.frames;for(var i=0;i<c.length;i++){;if(c[i].document instanceof HTMLDocument){b=b.concat(be.yooper.myDo.getDocsForDoc(c[i].document))}};return b};this.refreshAll=function(a,b,c){;topURL=(a[0]=="H+")?a[5]:(a[0]=="H-")?a[2]:a[1];frURL=(a[0]=="H+")?a[6]:(a[0]=="H-")?a[3]:a[2];var d=be.yooper.myDo.docsForURL(topURL,frURL);for(var i=0;i<d.length;i++){if(a[0]=="H+"){be.yooper.myDo.doHCommand(d[i],a,be.yooper.myAjax.FROM_USER,c)}else if(a[0]=="H-"){be.yooper.myDo.doUndoCommand(d[i],a)}else if(a[0]=="H0"){be.yooper.myDo.changeHighlights(d[i],false)}}};this.doHCommand=function(a,b,c,d,e){var f=b;var g=f[1].toLowerCase();var h=f[2];var k=f[5];var l=f[6];var m=f[7];var n=f[8];var o=f[9];var p=f[10];var q=f[11];var r=f[12];var s=f[13];var t=false;if(be.yooper.debug_doHCommand){};if(e&e!=undefined&&0<e.length){}else if(a.body){e=this.getTextContent(a)}else if(a.documentElement&&a.documentElement.body){e=this.getTextContent(a.documentElement)}else{;return true};if(!be.yooper.myDomain.isDouble(k)){var u=a.getElementById(q);if(u){;if(u.getAttribute("f")!=d){;var v=a.getElementsByClassName('yooper_span');for(var j=v.length-1;0<=j;j--){u=v[j];if(u.id==q){u.setAttribute('f',d);u.setAttribute('style','background-color: '+h+';')}}}}else{start=be.yooper.myPendingH.stringToBoundary(a,m,n);if(!start){;t=true}else{end=be.yooper.myPendingH.stringToBoundary(a,o,p);if(!end){;t=true}else{if(be.yooper.debug_assert){if(l!=be.yooper.myDomain.rewriteHref(a.location.href)){};if(m.indexOf("frames")==-1&&o.indexOf("frames")==-1){if(be.yooper.debug_stringToBoundary){};dStart=be.yooper.myPendingH.boundaryToString(a,start.container,start.offset);if(dStart[0].indexOf(m)==-1){};if(dStart[1]!=n){};dEnd=be.yooper.myPendingH.boundaryToString(a,end.container,end.offset);if(dEnd[0].indexOf(o)==-1){};if(dEnd[1]!=p){}};if(start.container===end.container&&end.offset<start.offset){}};if(be.yooper.debug_doHCommand){};var w=a.createRange();start.offset=(start.offset<=start.container.length)?start.offset:start.container.length;w.setStart(start.container,start.offset);end.offset=(end.offset<=end.container.length)?end.offset:end.container.length;w.setEnd(end.container,end.offset);if(be.yooper.myPendingH.signature(w.toString())!=r){t=true}else{be.yooper.myDo.show(start,end,h,q,d,c)}}};if(t&&e){;x=this.findWords(e,g);if(1<x.length){;this.lastPos=999999;t=this.showPos(a,x[0],x[1],h,q,d,c)}}}}else{;u=a.getElementById(q);if(u){this.changeHighlights(a,0)};var x=this.findWordsMultiple(e,g);if(1<=x.length){;this.lastPos=999999;for(var i=0;i<x.length;i+=2){t=this.showPos(a,x[i],x[i+1],h,q,d,c)}}else{};t=true};return t};this.doUndoCommand=function(a,b){hNumber=b[1];spans=a.getElementsByClassName('yooper_span');for(var i=spans.length-1;0<=i;i--){span=spans[i];if(span.getAttribute("id")==hNumber){var c=span.childNodes;if(c.length<=0){}else{while(0<c.length){span.parentNode.insertBefore(c[0],span)};if(0<span.textContent.length){};span.parentNode.removeChild(span)}}}};this.docsForURL=function(a,b){var c=[];var d=Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);var f=d.getEnumerator("navigator:browser");while(f.hasMoreElements()){var g=f.getNext();var h=g.getBrowser();var j=h.browsers.length;for(var k=0;k<j;k++){var l=h.getBrowserAtIndex(k);if(a==be.yooper.myDomain.rewriteHref(l.currentURI.spec)){if(a==b){;c.push(l.contentDocument)}else{var m=be.yooper.myDo.getDocsForDoc(l.contentDocument);if(0<m.length){;for(var i=0;i<m.length;i++){try{if(be.yooper.myDomain.rewriteHref(m[i].location.href)==b){c.push(m[i])}}catch(e){}}}}}}};return c};this.showPos=function(a,b,c,d,f,g,h){var i=new Object;var j=new Object;try{retry=this.setBoundariesFromPos(a,b,c,i,j)}catch(e){;retry=true};if(!retry){this.show(i,j,d,f,g,h)};return retry};this.show=function(a,b,c,d,f,g){var h=a.container;var i=a.offset;var j=b.container;var k=b.offset;if(!be.yooper.myDomain.ancestorsAreOK(h)||!be.yooper.myDomain.ancestorsAreOK(j)){;return};var l=h.ownerDocument.createRange();try{l.setStart(h,i)}catch(e){i=(i<0)?0:h.length;l.setStart(h,i)};try{l.setEnd(j,k)}catch(e){k=(k<0)?0:j.length;l.setEnd(j,k)};var m=l.commonAncestorContainer;var n=m.ownerDocument.defaultView.getSelection();var o=false;o=o||n.containsNode(h,true)||n.containsNode(j,true);if(be.yooper.debug_show){};var p=m.ownerDocument.createRange();var q;if(h===j){p.setStart(h,i);p.setEnd(j,k);q=this.show2(p,c,d,f)}else{node=be.yooper.DOM.nextNode(h);p.setStart(h,i);p.setEnd(h,h.length);q=this.show2(p,c,d,f);while(node&&node!==j){next=be.yooper.DOM.nextNode(node);if(node.nodeType==3){p.selectNode(node);this.show2(p,c,d,f)};node=next};p.setStart(j,0);p.setEnd(j,k);q=this.show2(p,c,d,f)}};this.show2=function(a,b,c,d){if(be.yooper.debug_doHCommand){};var e=a.startContainer.ownerDocument.createElement("span");e.className='yooper_span';e.id=c;e.setAttribute("f",d);e.setAttribute('style','background-color: '+b+';');a.surroundContents(e);return e};this.changeHighlights=function(a,b){var c=true;while(c){c=false;var d=a.getElementsByClassName('yooper_span');if(d.length<=0){break};for(var i=d.length-1;0<=i;i--){var e=d[i];if(b){var f=e.getAttribute('style').match(/.*[b][a][c][k][g][r][o][u][n][d][-][c][o][l][o][r][:]([^;]*)[;]/)[1];var g=e.getAttribute('style').match(/.*[ ][c][o][l][o][r][:]([^;]*)[;]/);if(f){if(g&&g[1]==f){;e.setAttribute('style','display: inline-block; background-color:'+f+'; color:black;')}else{;e.setAttribute('style','display: inline-block; background-color:'+f+'; color:'+f+";");e.title=e.textContent}}}else{var h=e.childNodes;if(h.length<=0){}else{for(var j=0;j<h.length;j++){e.parentNode.insertBefore(h[j],e)}}};if(!b){if(0<e.textContent.length){;c=true}else{e.parentNode.removeChild(e)}}}}};this.findWordsMultiple=function(a,b){var c=new RegExp("[0-9'\\-A-Za-z_\\u0080-\\u10FFFF]+","gi");var d="[^0-9'\\-A-Za-z_\\u0080-\\u10FFFF]+";var e="",wordCount=0;var f=c.exec(b);while(f){if(!e){e=f}else{e+=d+f};wordCount++;f=c.exec(b)};if(wordCount<=1&&e.length<4&&!(/\d/.test(e))){return[]};if(wordCount==1){e=d+e+d};c=new RegExp(e,"gi");var g=[];var h=c.exec(a);while(h){g.push(h.index);g.push(h.index+h[0].length);h=c.exec(a)};return g};this.findWords=function(a,b){var c=new RegExp("\\b[0-9'\\-A-Za-z_\\u0080-\\u10FFFF]+\\b","gi");var d=[];var e=0,wordCount=0;m=c.exec(b);while(m){if(d[m]==undefined){e++;d[m]=[c.lastIndex-m[0].length]}else{d[m].push(c.lastIndex-m[0].length)};wordCount++;m=c.exec(b)};var f=[];var g=0;var h=0;var l=0;for(var m in d){if(l==0&&wordCount==1){if(m.length<4&&!(/\d/.test(m))){return[]}c=new RegExp(m,"gi")}else{c=new RegExp("\\b"+m+"\\b","gi")};var n=a.split(c);var p=0;for(var i=0;i<n.length-1;i++){p+=n[i].length;var o=d[m];for(var q=0;q<o.length;q++){var r=p-o[q];if(f[100000+r]==undefined){f[100000+r]={p:r,c:1,words:[m]}}else{f[100000+r].c=f[100000+r].c+1;f[100000+r].words.push(m)};if(g<f[100000+r].c){h=r;g=f[100000+h].c}};p+=m.length};l++};f.sort(this.sortCount);var s=[];var t=-999;var u=5;var v,c2;for(var i=0;i<f.length;i++){if(f[i]&&t+u<f[i].p){v=f[i].p;c2=f[i].c;minPos=99999;maxPos=0;words2=f[i].words;for(var j=0;j<words2.length;j++){for(var k=0;k<d[words2[j]].length;k++){var w=f[i].p+d[words2[j]][k];minPos=Math.min(minPos,w);maxPos=Math.max(maxPos,w+words2[j].length-1)}};i2=i-1;while(f[i2]&&v-u<f[i2].p){c2+=f[i2].c;words2=f[i2].words;for(j=0;j<words2.length;j++){for(k=0;k<d[words2[j]].length;k++){w=f[i2].p+d[words2[j]][k];minPos=Math.min(minPos,w);maxPos=Math.max(maxPos,w+words2[j].length-1)}};i2--};i2=i+1;while(f[i2]&&f[i2].p<v+u){c2+=f[i2].c;words2=f[i2].words;for(j=0;j<words2.length;j++){for(k=0;k<d[words2[j]].length;k++){w=f[i2].p+d[words2[j]][k];minPos=Math.min(minPos,w);maxPos=Math.max(maxPos,w+words2[j].length-1)}};i2++};if(0.75*wordCount<c2){t=maxPos;if(maxPos-minPos<b.length*2){s.push(minPos);s.push(maxPos)}else{}}}};return s};this.sortCount=function(a,b){return a.p==b.p?0:a.p<b.p?-1:1};this.getTextContent=function(a){;var b=be.yooper.DOM.firstChild(a.body);var c="";while(b){if(b.nodeType==3){c+=b.textContent.toLowerCase()};b=be.yooper.DOM.nextNode2(b)};return c};this.setBoundariesFromPos=function(a,b,c,d,e){;if(this.lastPos<=b&&be.yooper.DOM.isIn(this.lastNode,a)){var f=this.lastNode;var g=this.lastPos}else{var f=be.yooper.DOM.firstChild(a.body);var g=0};while(f){if(f.nodeType==3){if(b<g+f.textContent.length){break};g+=f.textContent.length};f=be.yooper.DOM.nextNode2(f)};if(!f){;return true};d.container=f;d.offset=b-g;while(f){if(f.nodeType==3){if(c<=g+f.textContent.length){break};g+=f.textContent.length};f=be.yooper.DOM.nextNode2(f)};if(!f){;return true};e.container=f;e.offset=c-g+1;this.lastPos=g;this.lastNode=f;return false}};be.yooper.urlBarListener=new function(){this.QueryInterface=function(a){if(a.equals(Components.interfaces.nsIWebProgressListener)||a.equals(Components.interfaces.nsISupportsWeakReference)||a.equals(Components.interfaces.nsISupports)){return this};throw Components.results.NS_NOINTERFACE;};this.onLocationChange=function(a,b,c){;be.yooper.browser.onLocationChange(a,b,c)};this.onStateChange=function(a,b,c,d){};this.onProgressChange=function(a,b,c,d,e,f){};this.onStatusChange=function(a,b,c,d){};this.onSecurityChange=function(a,b,c){}};be.yooper.browser=new function(){this.oldURL=null;this.oldTabIndex=null;this.listeningToTab=false;this.onLoad=function(){;gBrowser.addProgressListener(be.yooper.urlBarListener,Components.interfaces.nsIWebProgress.NOTIFY_LOCATION);var a=document.getElementById("appcontent");if(a){a.addEventListener("DOMContentLoaded",be.yooper.currentUser.onPageLoaded,true)};if(!this.listeningToTab){this.listeningToTab=true;be.yooper.container=gBrowser.tabContainer;be.yooper.container.addEventListener("TabSelect",be.yooper.currentUser.onTabSelect,false)};var b=document.getElementById("strings");document.getElementById('be.yooper.color').setAttribute("tooltiptext",b.getString("ttColorPicker"));document.getElementById('be.yooper.undo').setAttribute("tooltiptext",b.getString("ttUndo"));document.getElementById('be.yooper.brain').setAttribute("tooltiptext",b.getString("ttMemory"));document.getElementById('be.yooper.share').setAttribute("tooltiptext",b.getString("ttShare"))};this.onLocationChange=function(a,b,c){;if(!c||c.spec==this.oldURL){return};this.oldURL=c.spec;be.yooper.myAjax.init(be.yooper.currentUser);myDoc=a.DOMWindow.document;be.yooper.myDomain.setCurrentDomain(myDoc.location);var d=be.yooper.myDomain.rewriteHref(myDoc.location.href);topURL2=d+"---";for(var e in be.yooper.cache.cache){if(be.yooper.cache.cache[e].URL.substr(0,topURL2.length)==topURL2){frURL=be.yooper.cache.cache[e].URL.substr(topURL2.length,9999);if(!be.yooper.cache.hasH(d,frURL)){;be.yooper.myAjax.doCommand(['H?',d,frURL])}else{}}};tIndex=be.yooper.currentUser.getCurrentTabIndex();if(this.oldTabIndex!=tIndex){;this.oldTabIndex=tIndex}else{be.yooper.myDo.reset();be.yooper.myDo.refreshCurrent(myDoc,d,-1)}}};window.addEventListener("load",be.yooper.browser.onLoad,false);
  5.